package com.javalearn;

public class SingleTon {
	public Integer testInt;
	protected SingleTon() {
		testInt = new Integer(1);
	}
	private volatile static SingleTon instance;
	public static SingleTon getInstance() {
		if(instance == null) {                 //第一次判断
			synchronized(SingleTon.class) {
				if(instance == null) {         //第二次判断
				     instance = new SingleTon();	
				}
			}
		}
		return instance;
	}
}
